<!DOCTYPE html>
<html lang="en">
<head>
    <title>Cart</title>
    <meta charset="utf-8" />

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <!-- GOOGLE WEB FONTS -->
    <link rel="stylesheet" href="css/font-awesome.min.css">

    <!-- BOOTSTRAP 3.3.7 CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css" />

    <!-- SLICK v1.6.0 CSS -->
    <link rel="stylesheet" href="css/slick-1.6.0/slick.css" />

    <link rel="stylesheet" href="css/jquery.fancybox.css" />
    <link rel="stylesheet" href="css/yith-woocommerce-compare/colorbox.css" />
    <link rel="stylesheet" href="css/owl-carousel/owl.carousel.min.css" />
    <link rel="stylesheet" href="css/owl-carousel/owl.theme.default.min.css" />
    <link rel="stylesheet" href="css/js_composer/js_composer.min.css" />
    <link rel="stylesheet" href="css/woocommerce/woocommerce.css" />
    <link rel="stylesheet" href="css/woocommerce/woocommerce-layout.css" />
    <link rel="stylesheet" href="css/woocommerce/woocommerce-smallscreen.css" />
    <link rel="stylesheet" href="css/yith-woocommerce-wishlist/style.css" />
    <link rel="stylesheet" href="css/custom.css" />
    <link rel="stylesheet" href="css/app-orange.css" id="theme_color" />
    <link rel="stylesheet" href="" id="rtl" />
    <link rel="stylesheet" href="css/app-responsive.css" />
</head>

<body class="page woocommerce-cart woocommerce-page">
<div class="body-wrapper theme-clearfix">
    <header id="header" class="header header-style1">
        <div class="header-top clearfix">
            <div class="container">
                <div class="rows">
                    <div class="wrap-myacc pull-right">
                        <div class="sidebar-account pull-left">
                            <div class="account-title">个人中心</div>

                            <div id="my-account" class="my-account">
                                <div class="widget-1 widget-first widget nav_menu-4 widget_nav_menu">
                                    <div class="widget-inner">
                                        <ul id="menu-my-account" class="menu">
                                            <li class="menu-my-account">
                                                <a class="item-link" href="my_account.html">
                                                    <span class="menu-title">我的账户</span>
                                                </a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>

                                <div class="widget-2 widget-last widget sw_top-4 sw_top">
                                    <div class="widget-inner">
                                        <div class="top-login">
                                            <div class="div-logined">
                                                <ul>
                                                    <li>
                                                        <a href="cart.html">
                                                            <span>我的收藏</span>
                                                        </a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="widget-2 widget-last widget sw_top-4 sw_top">
                                    <div class="widget-inner">
                                        <div class="top-login">
                                            <div class="div-logined">
                                                <ul>
                                                    <li>
                                                        <a href="login.html">
                                                            <span>登录/注册</span>
                                                        </a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="widget-2 widget-last widget sw_top-4 sw_top">
                                    <div class="widget-inner">
                                        <div class="top-login">
                                            <div class="div-logined">
                                                <ul>
                                                    <li>
                                                        <a @click="loginout(userName)" href="login.html">
                                                            <span>退出登录</span>
                                                        </a>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="pull-left top2">
                            <div class="widget-1 widget-first widget nav_menu-2 widget_nav_menu">
                                <div class="widget-inner">
                                    <ul id="menu-checkout" class="menu">
                                        <li class="menu-checkout">
                                            <a class="item-link" href="#">
                                                <span class="menu-title">欢迎来到Cabbage</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="header-mid clearfix">
            <div class="container">
                <div class="rows">
                    <!-- 右上LOGO -->
                    <div class="etrostore-logo pull-left">
                        <br>
                        <br>
                        <h1 style="color:orange">CABBAGE</h1>
                        <H4 style="color:rgb(189, 189, 189)">Your Online Bookstore</H4>
                    </div>
                    <!-- /右上LOGO -->
                    <div class="mid-header pull-right">
                        <div class="widget-1 widget-first widget sw_top-2 sw_top">
                            <div class="widget-inner">
                                <div class="top-form top-search">
                                    <div class="topsearch-entry">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="header-bottom clearfix">
            <div class="container">
                <div class="rows">

                </div>
            </div>
        </div>
    </header>

    <div class="container">
        <div class="row">
            <div id="contents" role="main" class="main-page col-lg-12 col-md-12 col-sm-12 col-xs-12">
                <div class="page type-page status-publish hentry">
                    <div class="post-6 page type-page status-publish hentry">
                        <div class="entry">
                            <div class="entry-content" id="wrapper">
                                <div class="woocommerce">
                                    <nav class="woocommerce-MyAccount-navigation">
                                        <ul class="nav nav-tabs">
                                            <li class="nav-item">
                                                <a href="#aboutme" data-toggle="tab" aria-expanded="false" class="nav-link active">
                                                    修改信息
                                                </a>
                                            </li>
                                            <li class="nav-item">
                                                <a href="#reset" data-toggle="tab" aria-expanded="false" class="nav-link">
                                                    修改密码
                                                </a>
                                            </li>
                                        </ul>
                                        <div class="tab-content">
                                            <div class="tab-pane show active" id="aboutme">
                                                <form id="form1" type="submit" action="#">
                                                    <div class="col-md-10">
                                                        <h5 class="mb-4 text-uppercase"><i
                                                                class="mdi mdi-account-circle mr-1"></i>
                                                        </h5>
                                                    </div>
                                                    <div class="row">
                                                        <div class="col-8">
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                            </div>

                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                        <label for="userID">用户ID</label>
                                                                        <input v-model="user.userID" type="text" class="form-control" id="userID"
                                                                               rows="4" readonly>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                        <label for="userName">用户名</label>
                                                                        <input v-model="user.userName" type="text" class="form-control" id="userName"
                                                                               rows="4">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                        <label for="password">用户密码</label>
                                                                        <input v-model="user.password" type="text" class="form-control" id="password"
                                                                               rows="4" >
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                        <label for="birthday">生日</label>
                                                                        <input v-model="user.birthday" type="date" class="form-control"
                                                                               id="birthday">
                                                                    </div>
                                                                </div>
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>
                                                            </div>

                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                        <label for="phone">电话号码</label>
                                                                        <input v-model="user.phone" type="text" class="form-control" id="phone"
                                                                               rows="4">
                                                                    </div>
                                                                </div>
                                                                <div class="row">
                                                                    <div class="col-md-2"></div>
                                                                    <div class="col-md-5">
                                                                        <div class="form-group">
                                                                        </div>
                                                                    </div>
                                                                </div>

                                                                <div class="row">
                                                                    <div class="col-md-2"></div>
                                                                    <div class="col-md-5">
                                                                        <div class="form-group">
                                                                            <label for="email">电子邮箱</label>
                                                                            <input v-model="user.email" type="text" class="form-control" id="email"
                                                                                   rows="4">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                                <div class="row">
                                                                    <div class="col-md-2"></div>
                                                                    <div class="col-md-5">
                                                                        <div class="form-group">
                                                                        </div>
                                                                    </div>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-1"></div>

                                                    </div>
                                                    <div class="text-center">
                                                        <button @click="SaveInfo(user)" type="button" class="btn btn-secondary waves-effect">保存</button>
                                                    </div>
                                                </form>

                                                <div class="table-responsive">
                                                </div>

                                            </div>

                                            <div class="tab-pane " id="reset">
                                                <div class="row">
                                                    <div class="col-sm-3"></div>
                                                    <div class="col-sm-6">
                                                        <form action="#"  >
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>

                                                                <!-- end col -->
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>

                                                                <!-- end col -->
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="useroldpassword">输入旧密码</label>
                                                                <input v-model="userOldPassword" type="text" name="nick" parsley-trigger="change"
                                                                       required="" placeholder="输入旧密码" class="form-control"
                                                                       id="useroldpassword" >
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>

                                                                <!-- end col -->
                                                            </div>
                                                            <div class="row">
                                                                <div class="col-md-2"></div>
                                                                <div class="col-md-5">
                                                                    <div class="form-group">
                                                                    </div>
                                                                </div>

                                                                <!-- end col -->
                                                            </div>
                                                            <div class="form-group">
                                                                <label for="pass1">输入新密码</label>
                                                                <input id="pass1" type="password" placeholder="Password"
                                                                       required="" class="form-control">
                                                            </div>
                                                            <div class="form-group text-center m-b-0">
                                                                <button @click="ResetPassword(userOldPassword,usersetpassword,userEmail)" class="btn btn-secondary waves-effect"
                                                                        type="submit">
                                                                    修改密码
                                                                </button>
                                                            </div>

                                                        </form>
                                                    </div>
                                                    <div class="col-sm-3"></div>
                                                </div>
                                            </div>

                                        </div>
                                    </nav>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--/个人信息-->
                    <div class="entry-content">
                        <div class="entry-summary">
                            <div class="woocommerce">
                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>

    <footer id="footer" class="footer default theme-clearfix">
        <div class="footer-copyright style1">
            <div class="container">
                <!-- Copyright text -->
                <div class="copyright-text ">
                    <center><p>Copyright &copy; 2022.Company name All rights reserved.cabbage</p></center>
                </div>
                <!-- /Copyright text -->
            </div>
        </div>
    </footer>
</div>
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery/jquery-migrate.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery/js.cookie.min.js"></script>
<!-- OPEN LIBS JS -->
<script type="text/javascript" src="js/owl-carousel/owl.carousel.min.js"></script>
<script type="text/javascript" src="js/slick-1.6.0/slick.min.js"></script>
<script type="text/javascript" src="js/yith-woocommerce-compare/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="js/sw_core/isotope.js"></script>
<script type="text/javascript" src="js/sw_core/jquery.fancybox.pack.js"></script>
<script type="text/javascript" src="js/sw_woocommerce/category-ajax.js"></script>
<script type="text/javascript" src="js/sw_woocommerce/jquery.countdown.min.js"></script>
<script type="text/javascript" src="js/wc-quantity-increment.min.js"></script>
<script type="text/javascript" src="js/woocommerce/cart.min.js"></script>
<script type="text/javascript" src="js/js_composer/js_composer_front.min.js"></script>
<script type="text/javascript" src="js/plugins.js"></script>
<script type="text/javascript" src="js/megamenu.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript" src="js/vue.js"></script>
<script src="/js/axios.min.js"></script>
</body>
</html>
<script src="assets/libs/parsleyjs/parsley.min.js"></script>
<script src="assets/js/pages/form-validation.init.js"></script>

</body>

</html>
<script type="text/javascript">
    var vm= new Vue(
        {
            el:"#wrapper",
            data:{
                user: {},
                usersetpassword:"",
                userOldPassword:"",
                userName:"",
                email:"",
            },
            methods:{
                SaveInfo:function(user){
                    console.log("------>",user);
                    axios.post('/usercenter/update',user)
                        .then(function (response) {
                            console.log(response.data);
                            if (response.data===1){
                                alert("修改成功！")
                            }
                        })
                        .catch(function (error) {
                            console.log(error);
                        })
                },
                ResetPassword:function (userOldPassword,usersetpassword,userName){
                    console.log(userOldPassword,usersetpassword,userName);
                    axios.get('/usercenter/reset',{
                        params: {
                            userOldPassword:userOldPassword,
                            usersetpassword:usersetpassword,
                            userName:userName
                        }
                    }).then(function (response){
                        console.log(response.data)
                        if (response.data==1){
                            alert("修改成功！")
                        }else alert("您输入的旧密码有误！")
                    })
                },
                loginout:function () {
                    window.localStorage.setItem("userName","");
                }

            },
            mounted(){
                _this=this
                var userName = window.localStorage.getItem("userName")
                this.userName=userName;
                console.log(userName);
                if(userName == undefined || userName == 'null' || userName === '' || userName == null){
                    alert("请先登录！！")
                    location.href="login.html";
                }
                if(typeof (userName)==='object'){
                    alert("请先登录！！")
                    location.href="login.html";
                }
                _this.userName=userName;
                _this.userName=userName;
                console.log("--"+userName);
                axios.get('/usercenter/getInfo', {
                    params: {
                        userName: userName
                    }
                }).then(function (response) {
                    _this.user = response.data;
                    _this.userName=response.data.userName;
                    console.log(response.data)
                }).catch(function(error){
                    console.log(error);
                })

                _this.userName=userName;
                console.log("--"+userName);
                axios.get('/usercenter/getInfo', {
                    params: {
                        userName: userName
                    }
                }).then(function (response) {
                    _this.user = response.data;
                    _this.userName=response.data.userName;
                    console.log(response.data)
                }).catch(function(error){
                    console.log(error);
                })
            }
        }
    )

</script>